package com.project.common.utils;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.myBeans.EntitySupport;

import java.util.List;

/**
 * 功能列表：
 * 设置分页参数——setPageParam
 * 获取总记录数——getTotal
 */
public class MyPageHelper {

    public static void setPageParam(EntitySupport entitySupport){

        if(entitySupport.getPageSize()!=0)
            PageHelper.startPage(entitySupport.getPageIndex(),entitySupport.getPageSize());

    }

    public static long getTotal(List dataList){

        PageInfo pageInfo = new PageInfo(dataList);

        return pageInfo.getTotal();
    }
}
